home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-14 | 9.6 KB | 353 lines | [TEXT/KAHL] |
- $$Loop Windows
- $$Message User Window, u:$Worksheet.name$.h
-
- $$File u:$Worksheet.name$.h
- /* $Worksheet.name$ Handle this Window */
- /* $CopyRight$ */
-
- /*
- File name: $Worksheet.name$.h
- Function: Handle a Window
- History: $Date$ Original by $Author$
-
- */
-
- /* ======================================================= */
- /* ======================================================= */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- void U_Init$Worksheet.name$Rec($Worksheet.name$RecPtr theWS);
-
- /* Initialize us so all our routines can be activated */
- void U_Init$Worksheet.name$(void);
-
- /* Close our window */
- void U_Close$Worksheet.name$($Worksheet.name$RecPtr theWS);
-
- /* Handle resizing scrollbars */
- void U_Resized$Worksheet.name$($Worksheet.name$RecPtr theWS,Rect *OldRect);
-
- /* Our window was moved */
- void U_Moved$Worksheet.name$(Rect *OldRect,WindowPtr whichWindow);
-
- /* Update our window, someone uncovered a part of us */
- void U_Update$Worksheet.name$($Worksheet.name$RecPtr theWS);
-
- /* Open our window and draw everything */
- void U_Open$Worksheet.name$($Worksheet.name$RecPtr theWS);
-
- /* Handle activation of our window */
- void U_Activate$Worksheet.name$($Worksheet.name$RecPtr theWS,Boolean Do_An_Activate);
-
- /* Handle action to our window, like controls */
- void U_DoButton$Worksheet.name$($Worksheet.name$RecPtr theWS,long RefCon, ControlHandle theControl, short *UnHiliteValue);
-
- $$if Worksheet.CheckboxesOrRadios
- /* Handle a checkbox being pressed */
- void U_DoCheckbox$Worksheet.name$($Worksheet.name$RecPtr theWS,ControlHandle theControl, short *NewValue);
-
- $$endif
- $$if Worksheet.Scrollbars
- /* Allow for special handling of scrollbars */
- void U_Scroll$Worksheet.name$($Worksheet.name$RecPtr theWS,long *RefCon, short code, Point *myPt);
-
- $$endif
- /* Handle any special window events */
- void U_DoEvent$Worksheet.name$($Worksheet.name$RecPtr theWS,EventRecord *myEvent);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- /* ======================================================= */
- /* ======================================================= */
-
- $$CloseFile
- $$Message User Window, u:$Worksheet.name$.c
-
- $$File u:$Worksheet.name$.c
- /* $Worksheet.name$ Handle this Window */
- /* $CopyRight$ */
-
- /*
- File name: $Worksheet.name$.c
- Function: Handle a Window
- History: $Date$ Original by $Author$
-
- */
-
- #include "mmCommon$Prototype.name$.h" /* Common */
- #include "Common$Prototype.name$.h" /* Common */
-
- #include "$Worksheet.name$.h" /* This file */
-
- /* ======================================================= */
-
- void U_Init$Worksheet.name$Rec($Worksheet.name$RecPtr theWS)
- {
- }
-
- /* ======================================================= */
-
- /* Routine: U_Init$Worksheet.name$ */
- /* Purpose: Initialize our window data to not in use yet */
-
- void U_Init$Worksheet.name$(void)
- {
- }
-
- /* ======================================================= */
-
- /* Routine: U_Close$Worksheet.name$ */
- /* Purpose: Close out the window */
-
- void U_Close$Worksheet.name$($Worksheet.name$RecPtr theWS)
- {
- }
-
- /* ======================================================= */
-
- /* Routine: U_Resized$Worksheet.name$ */
- /* Purpose: We were resized or zoomed, update the scrolling scrollbars */
- /* OldRect is the size of the window before the resize */
-
- void U_Resized$Worksheet.name$($Worksheet.name$RecPtr theWS,Rect *OldRect)
- {
- }
-
- /* ======================================================= */
-
- /* Routine: U_Moved$Worksheet.name$ */
- /* Purpose: We were moved, possibly to another screen and screen depth */
- /* OldRect is the size of the window before the resize */
-
- void U_Moved$Worksheet.name$(Rect *OldRect,WindowPtr whichWindow)
- {
- }
-
- /* ======================================================= */
-
- /* Routine: U_UpDate$Worksheet.name$ */
- /* Purpose: Update our window */
- /* User can place code before or after the DrawControls */
-
- void U_Update$Worksheet.name$($Worksheet.name$RecPtr theWS)
- {
-
- DrawControls(theWS->theWindow); /* Draw all the controls */
- }
-
- /* ======================================================= */
-
- /* Routine: U_Open$Worksheet.name$ */
- /* Purpose: Open our window */
-
- void U_Open$Worksheet.name$($Worksheet.name$RecPtr theWS)
- {
-
- if ((theWS != nil) && (theWS->theWindow != nil)) /* See if opened OK */
- {
- }
- }
-
- /* ======================================================= */
-
- /* Routine: U_Activate$Worksheet.name$ */
- /* Purpose: We activated or deactivated */
-
- void U_Activate$Worksheet.name$($Worksheet.name$RecPtr theWS,Boolean Do_An_Activate)
- {
-
- if (Do_An_Activate) /* Handle the activate */
- {
- }
- else
- {
- }
- }
-
- /* ======================================================= */
-
- /* Routine: U_DoButton$Worksheet.name$ */
- /* Purpose: Handle extra buttons in our window */
-
- /* RefCon = The RefCon of the button that was pressed */
- /* theControl = The ControlHandle of the button that was pressed */
- /* UnHiliteValue = 0 for unhilite, we can change that */
- void U_DoButton$Worksheet.name$($Worksheet.name$RecPtr theWS,long RefCon, ControlHandle theControl,short *UnHiliteValue)
- {
- short theSelection; /* For palette and popup selections */
-
-
- switch (RefCon) /* Select correct button */
- {
- $$Loop Control.type = Button
- case ResC_$Control.name$: /* Button, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$Loop Control.type = Icon
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Icon button, $Control.FullName$ */
- break;
-
- $$endif
- $$EndLoop
- $$Loop Control.type = Sicn
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Sicn button, $Control.FullName$ */
- break;
-
- $$endif
- $$EndLoop
- $$Loop Control.type = Picture
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Picture button, $Control.FullName$ */
- break;
-
- $$endif
- $$EndLoop
- $$Loop Control.type = UButton
- case ResC_$Control.name$: /* Plugin button, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$Loop Control.type = HotRect
- $$if Control.HotSpot
- case ResC_$Control.name$: /* HotSpot, $Control.FullName$ */
- break;
-
- $$endif
- $$EndLoop
- $$Loop Control.type = Popup
- case ResC_$Control.name$: /* Popup menu, $Control.FullName$ */
- theSelection = GetCtlValue(theWS->Ctrl_$Control.name$); /* Get the Popup selection value */
- theWS->Value_$Control.name$ = theSelection;
- switch (theSelection) /* Select correct item */
- {
- $$Loop PopupItems
- case $Control.PopupID$: /* $Control.PopupID$, for $Control.PopupName$ */
- break;
- $$EndLoop PopupItems
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- break;
-
- $$EndLoop
- $$Loop Control.type = Palette
- case ResC_$Control.name$: /* Palette, $Control.FullName$ */
- theSelection = GetCtlValue(theWS->Ctrl_$Control.name$);/* Get the palette value, 0xrrcc, rr is row, cc is column */
- theWS->Value_$Control.name$ = theSelection; /* Get the palette value */
- switch (theSelection) /* Select correct item */
- {
- $$Loop PaletteItems
- case $Control.PaletteID$: /* Row $Control.Row$, Column $Control.Column$ */
- break;
- $$EndLoop PaletteItems
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- break;
-
- $$EndLoop
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
-
- }
-
- $$if Worksheet.CheckboxesOrRadios
- /* ======================================================= */
-
- /* Routine: U_DoCheckBox$Worksheet.name$ */
- /* Purpose: Handle ckboxes and radios in our window */
-
- void U_DoCheckbox$Worksheet.name$($Worksheet.name$RecPtr theWS,ControlHandle theControl,short *NewValue)
- {
- long RefCon; /* RefCon for controls */
-
-
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct button */
- {
- $$Loop Control.type = Checkbox
- case ResC_$Control.name$: /* Checkbox, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$Loop Control.type = Radio
- case ResC_$Control.name$: /* Radio, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$Loop Control.type = UToggle
- case ResC_$Control.name$: /* Toggle Plugin, $Control.FullName$ */
- break;
-
- $$EndLoop
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- $$endif
- $$if Worksheet.Scrollbars
- /* ======================================================= */
-
- /* Routine: U_Scroll$Worksheet.name$ */
- /* Purpose: Special handling of scrollbars */
- /* Return RefCon as 0 to inhibit standard routine from handling it */
-
- void U_Scroll$Worksheet.name$($Worksheet.name$RecPtr theWS,long *RefCon,short code,Point *myPt)
- {
-
-
- switch (*RefCon) /* Select correct button */
- {
- $$Loop Control.type = ScrollBar
- case ResC_$Control.name$: /* ScrollBar, $Control.FullName$ */
- /* HandleWScrollBar(myPt,code,1,10,theControl); x code,Inc,PageInc,handle x */
- theWS->Value_$Control.name$ = GetCtlValue(theWS->Ctrl_$Control.name$);/* Get the scrollbar value */
- break;
-
- $$EndLoop
- $$Loop Control.type = UGauge
- case ResC_$Control.name$: /* Plugin gauge, $Control.FullName$ */
- /* HandleWScrollBar(myPt,code,1,10,theControl); x code,Inc,PageInc,handle x */
- theWS->Value_$Control.name$ = GetCtlValue(theWS->Ctrl_$Control.name$);/* Get the scrollbar value */
- break;
-
- $$EndLoop
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- $$endif
- /* ======================================================= */
-
- /* Routine: U_DoEvent$Worksheet.name$ */
- /* Purpose: Handle any special window events */
-
- void U_DoEvent$Worksheet.name$($Worksheet.name$RecPtr theWS,EventRecord *myEvent)
- {
- }
-
- /* ======================================================= */
- /* ======================================================= */
- $$CloseFile
- $$EndLoop
-
-
-